import axios from 'axios';

// 设置响应拦截
axios.interceptors.response.use(res=>{
	console.log("成功响应1：",res);
	return res;
},err=>{
	return err;
})
// 单一任务：这个做什么事
axios.interceptors.response.use(res=>{
	console.log("成功响应2：",res);
	return res;
},err=>{
	return err;
})
// 单一任务：这个做什么事
axios.interceptors.response.use(res=>{
	console.log("成功响应3：",res);
	return res;
},err=>{
	return err;
})

let base = 'http://www.damoxueyuan.com:8900';

// 获取题分类
export const getCategoryList = params => { 
	return axios.get(`${base}/api/q_category?_limit=50`, params).then(res => res.data); 
};
// 添加题目
export const addQfe = params => { return axios.post(`${base}/api/q_fe`, params).then(res => res.data); };
//===========================================课程管理
// getIcktCategoryList,getIcktCourseVersionList,getIcktCourseDailyList,addCourseDailyContent
// 所属分类
export const getIcktCategoryList = params => { 
	return axios.get(`${base}/api/ickt_course_category?_limit=200`, params).then(res => res.data); 
};
// 所属版本
export const getIcktCourseVersionList = params => { 
	return axios.get(`${base}/api/ickt_course_version?_limit=200`, params).then(res => res.data); 
};
// 所属周期
export const getIcktCourseDailyList = params => { 
	return axios.get(`${base}/api/ickt_course_daily?_limit=200`, params).then(res => res.data); 
};

// 添加周期
export const addCourseDaily = params => { return axios.post(`${base}/api/ickt_course_daily`, params).then(res => res.data); };
// 添加周期内容
export const addCourseDailyContent = params => { return axios.post(`${base}/api/ickt_course_daily_content`, params).then(res => res.data); };
//===========================================课程管理


// 以前内容
export const requestLogin = params => { return axios.post(`${base}/api/login`, params).then(res => res.data); };

export const getUserList = params => { return axios.get(`${base}/api/user/list`, { params: params }); };

export const getUserListPage = params => { return axios.get(`${base}/api/user/listpage`, { params: params }); };

export const removeUser = params => { return axios.get(`${base}/api/user/remove`, { params: params }); };

export const batchRemoveUser = params => { return axios.get(`${base}/api/user/batchremove`, { params: params }); };

export const editUser = params => { return axios.get(`${base}/api/user/edit`, { params: params }); };

export const addUser = params => { return axios.get(`${base}/api/user/add`, { params: params }); };